﻿using Codemonk.Pease.Common;
using Codemonk.Pease.Server.Serialization;
using System;
using System.Linq.Expressions;

namespace Codemonk.Pease.Demo
{
    public static class InterfaceProxy
    {
        static InterfaceProxy()
        {
            proxy = new InterfaceProxy<string>
            {
                Communicator = new HttpCommunicator(),
                Server = new InterfaceServer { Address = "http://localhost:546/do.ashx" },
                Serializater = new JsonSerializater()
            };
        }
        private static InterfaceProxy<string> proxy;

        public static void Invoke<I, E, B>(Expression<Func<I, Action<E, Action<Exception>, Action<B>>>> function, E entity, Action<Exception> error, Action<B> back)
        {
            proxy.Invoke<I, E, B>(function, entity, error, back);
        }
    }
}
